package com.ruoyi.web.controller.websocketApi;

import com.alipay.api.AlipayApiException;
import com.ruoyi.common.core.page.ResponseResult;
import com.ruoyi.system.websocket.WebSocketDto;
import com.ruoyi.system.websocket.WebSocketServer1;
import com.ruoyi.web.controller.app.AppController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "开放接口---代付订单")
@RestController
@RequestMapping("/api/websocket")
public class SendWebSocketController extends AppController {

    @Resource
    private WebSocketServer1 orderPayService;


    @ApiOperation(value = "web发送消息")
    @PostMapping("/send")
    public ResponseResult send(@RequestBody WebSocketDto webSocketDto) throws AlipayApiException {
        orderPayService.SendMessage(webSocketDto.getMessage(), webSocketDto.getUserId(),webSocketDto.getType());

        return ResponseResult.createBySuccess();
    }


}
